#
# Generic DISTRO_COMPAT_REPOS for WCE Upups
#

if [ "$DISTRO_COMPAT_VERSION" = "" ] ; then
	[ -f ./DISTRO_SPECS ] && . ./DISTRO_SPECS
fi

case "$DISTRO_TARGETARCH" in
	x86)    DBIN_ARCH=i386  ;;
	x86_64) DBIN_ARCH=amd64 ;;
esac

case $DISTRO_COMPAT_VERSION in
	precise|trusty) DDB_COMP=bz2 ;; #older versions
	*) DDB_COMP=xz ;;
esac

#----------------------
#PKG_DOCS_DISTRO_COMPAT - where to download the compat-distro pkgs databases from
#---------------------
# 1|2|3
#   1 - domain. for testing the url.
#   2 - full URI of the database file.
#   3 - name of db file when local and after being processed into standard format

PKG_DOCS_DISTRO_COMPAT="
z|http://archive.ubuntu.com/ubuntu/dists/${DISTRO_COMPAT_VERSION}/main/binary-${DBIN_ARCH}/Packages.${DDB_COMP}|Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-main
z|http://archive.ubuntu.com/ubuntu/dists/${DISTRO_COMPAT_VERSION}/universe/binary-${DBIN_ARCH}/Packages.${DDB_COMP}|Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-universe
z|http://archive.ubuntu.com/ubuntu/dists/${DISTRO_COMPAT_VERSION}/multiverse/binary-${DBIN_ARCH}/Packages.${DDB_COMP}|Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-multiverse
"

#-------------------
#REPOS_DISTRO_COMPAT - hardcode the compat-distro repos in here...
#-------------------
# 1|2|3
#   1 - domain. for testing the url.
#   2 - full URI of the repo
#   3 - name of db-file(s) associated with that repo. it may have glob wildcards.

REPOS_DISTRO_COMPAT="
z|http://archive.ubuntu.com/ubuntu|Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-*
z|http://mirrors.kernel.org/ubuntu|Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-*
z|ftp.osuosl.org/pub/ubuntu|Packages-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}-*
"


#---------------
# fix variables
#---------------
PKG_DOCS_DISTRO_COMPAT="$(echo "$PKG_DOCS_DISTRO_COMPAT" | sed '/^$/d' | tr '\n' ' ' | sed 's% $%%')"
REPOS_DISTRO_COMPAT="$(echo "$REPOS_DISTRO_COMPAT" | sed '/^$/d' | tr '\n' ' ' | sed 's% $%%')"

